import $ from 'jquery';
import Button from './Button';

export default class StrikethroughButton extends Button{

  _activeStatus() {
    let active;
    active = document.queryCommandState('strikethrough') === true;
    this.setActive(active);
    return this.active;
  }

  command() {
    document.execCommand('strikethrough');
    if (!this.editor.util.support.oninput) {
      this.editor.trigger('valuechanged');
    }
    return $(document).trigger('selectionchange');
  }
}

StrikethroughButton.prototype.name = 'strikethrough';
StrikethroughButton.prototype.icon = 'strikethrough';
StrikethroughButton.prototype.htmlTag = 'strike';
StrikethroughButton.prototype.disableTag = 'pre';